From: Florian Müllner Date: Tue, 23 Aug 2022 14:30:32 +0000 (+0200) Subject: status/bluetooth: Expose adapter-state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~452^2^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=d54dc08a32d140197036d52e1d854d59e3f7f7d1;p=gnome-shell.git status/bluetooth: Expose adapter-state GnomeBluetooth now exposes a more precise state than the binary "adapter fully powerered on/off" property. Expose that on the BtClient object to make it available to the toggle and indicator. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5773 Part-of: --- diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index f0a692380..9580e7b4c 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -7,6 +7,8 @@ const {QuickToggle, SystemIndicator} = imports.ui.quickSettings; const {loadInterfaceXML} = imports.misc.fileUtils; +const {AdapterState} = GnomeBluetooth; + const BUS_NAME = 'org.gnome.SettingsDaemon.Rfkill'; const OBJECT_PATH = '/org/gnome/SettingsDaemon/Rfkill'; @@ -23,6 +25,9 @@ const BtClient = GObject.registerClass({ 'active': GObject.ParamSpec.boolean('active', '', '', GObject.ParamFlags.READABLE, false), + 'adapter-state': GObject.ParamSpec.enum('adapter-state', '', '', + GObject.ParamFlags.READABLE, + AdapterState, AdapterState.ABSENT), }, Signals: { 'devices-changed': {}, @@ -38,6 +43,8 @@ const BtClient = GObject.registerClass({ this.notify('active'); this.notify('available'); }); + this._client.connect('notify::default-adapter-state', + () => this.notify('adapter-state')); this._client.connect('notify::default-adapter', () => { const newAdapter = this._client.default_adapter ?? null; @@ -95,6 +102,10 @@ const BtClient = GObject.registerClass({ return this._client.default_adapter_powered; } + get adapter_state() { + return this._client.default_adapter_state; + } + toggleActive() { this._proxy.BluetoothAirplaneMode = this.active; if (!this._client.default_adapter_powered)